home *** CD-ROM | disk | FTP | other *** search
/ X User Tools / X User Tools (O'Reilly and Associates)(1994).ISO / sun4c / archive / tcltk.z / tcltk / slib / tk / demos / showVars.tcl < prev    next >
Text File  |  1994-09-20  |  800b  |  27 lines

  1. # showVars w var var var ...
  2. #
  3. # Create a top-level window that displays a bunch of global variable values
  4. # and keeps the display up-to-date even when the variables change value
  5. #
  6. # Arguments:
  7. #    w -    Name to use for new top-level window.
  8. #    var -    Name of variable to monitor.
  9.  
  10. proc showVars {w args} {
  11.     catch {destroy $w}
  12.     toplevel $w
  13.     wm title $w "Variable values"
  14.     label $w.title -text "Variable values:" -width 20 -anchor center \
  15.         -font -Adobe-helvetica-medium-r-normal--*-180*
  16.     pack $w.title -side top -fill x
  17.     foreach i $args {
  18.     frame $w.$i
  19.     label $w.$i.name -text "$i: "
  20.     label $w.$i.value -textvar $i
  21.     pack $w.$i.name $w.$i.value -side left
  22.     pack $w.$i -side top -anchor w
  23.     }
  24.     button $w.ok -text OK -command "destroy $w"
  25.     pack $w.ok -side bottom -pady 2
  26. }
  27.